package publisherSubscriber;

import cosEventComm.PullSupplier;

public class Subscriber {
	private String subsciberName;
	private PullSupplier consumer;
	private Thread thread;
	private ActionExecutor executor;
	
	protected Subscriber(String subsciberName, PullSupplier consumer) {
		super();
		this.subsciberName = subsciberName;
		this.consumer = consumer;
		
		executor = new ActionExecutor(consumer);
		thread = new Thread(executor);
		thread.start();
	}

	public String getSubsciberName() {
		return subsciberName;
	}
	
	@SuppressWarnings("deprecation")
	public void disconnect(){
		thread.stop();
		consumer.disconnect_pull_supplier();
	}
	

	public void setAction(Action action){
		executor.setAction(action);		
	}
	
	
	
	
}
